]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
workspaceThumbnail: Use current number of workspaces for sizes
authorGeorges Basile Stavracas Neto <georges.stavracas@gmail.com>
Wed, 27 Jan 2021 16:29:53 +0000 (13:29 -0300)
committerMarge Bot <marge-bot@gnome.org>
Fri, 29 Jan 2021 15:01:03 +0000 (15:01 +0000)
There are situations where MetaWorkspaceManager and ThumbnailsBox disagree
on the number of workspaces, for example when animating them out. It's more
important to follow the visible number of workspaces while they're updated.

Make vfunc_get_preferred_width() and vfunc_get_preferred_height() use the
current number of workspace thumbnails to calculate their sizes, instead of
MetaWorkspaceManager's n-thumbnails property.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1593>

js/ui/workspaceThumbnail.js

index 839ab89e439aa51fb82157837ad044b6af352337..4ca1dd48b82027d76d145d1f3a2e33e5c25de7ed 100644 (file)
@@ -1178,13 +1178,12 @@ var ThumbnailsBox = GObject.registerClass({
     }
 
     vfunc_get_preferred_height(forWidth) {
-        let workspaceManager = global.workspace_manager;
         let themeNode = this.get_theme_node();
 
         forWidth = themeNode.adjust_for_width(forWidth);
 
         let spacing = themeNode.get_length('spacing');
-        let nWorkspaces = workspaceManager.n_workspaces;
+        let nWorkspaces = this._thumbnails.length;
         let totalSpacing = (nWorkspaces - 1) * spacing;
 
         const avail = forWidth - totalSpacing;
@@ -1200,11 +1199,10 @@ var ThumbnailsBox = GObject.registerClass({
         // Note that for getPreferredHeight/Width we cheat a bit and skip propagating
         // the size request to our children because we know how big they are and know
         // that the actors aren't depending on the virtual functions being called.
-        let workspaceManager = global.workspace_manager;
         let themeNode = this.get_theme_node();
 
         let spacing = themeNode.get_length('spacing');
-        let nWorkspaces = workspaceManager.n_workspaces;
+        let nWorkspaces = this._thumbnails.length;
         let totalSpacing = (nWorkspaces - 1) * spacing;
 
         const naturalWidth =